<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2"/>
    <g:set var="entityName" value="${message(code: 'lead.label', default: 'lead')}"/>
    <title>编辑线索</title></head>

<body>
<div class="main-body">
    <div class="page-wrapper">
        <!-- Page-header start -->
        <div class="page-header">
            <div class="page-header-title">
                <h4>编辑线索</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    <li class="breadcrumb-item">
                        <g:link controller="lead" action="index">线索列表</g:link>
                    </li>
                    <li class="breadcrumb-item">编辑线索</li>
                </ul>
            </div>
        </div>
        <!-- Page-header end -->
        <!-- Page-body start -->
        <div class="page-body">
            <g:if test="${flash.message}">
                <div class="message alert alert-info" role="status">${flash.message}
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">×</span></button>
                </div>
            </g:if>
            <g:hasErrors bean="${this.lead}">
                <ul class="errors" role="alert">
                    <g:eachError bean="${this.lead}" var="error">
                        <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                            <g:message error="${error}"/></li></g:eachError>
                </ul>
            </g:hasErrors>
            <g:form resource="${this.lead}" method="PUT">

                <div class="card">
                    <div class="card-header">
                        <h5>公司信息</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label is-required">公司名称</label>

                            <div class="col-md-3">
                                <g:textField class="form-control" name="company" id="company"
                                             value="${this.lead?.company}"/>
                            </div>

                            <label class="col-md-2 col-form-label">人数</label>

                            <div class="col-md-3">
                                <g:textField class="form-control integer" name="numberOfEmployees"
                                             id="numberOfEmployees"
                                             value="${this.lead?.numberOfEmployees}"/>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">行业</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="industry" id="industry" optionValue="name"
                                          optionKey="id"
                                          from="${com.next.Industry.list()}" noSelection="${['': '请选择']}"
                                          value="${this.lead?.industry?.id}"/>
                            </div>

                            <label class="col-md-2 col-form-label">网站</label>

                            <div class="col-md-3">
                                <g:field type="url" class="form-control" name="website" id="website"
                                             value="${this.lead?.website}"/>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">地址</label>
                            <div class="col-md-3">
                                <g:field class="form-control" name="address" id="address" value="${this.lead?.address}"/>
                            </div>
                            <label class="col-md-2 col-form-label">所有人</label>

                            <div class="col-md-3">
                              <g:select class="form-control" disabled="disabled" name="user" id="user"
                                        optionKey="id"
                                        from="${com.next.User.list()}" noSelection="${['': '请选择']}"
                                        value="${this.lead?.user?.id}"/>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">客户</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="account.id" value="${this.lead?.account?.id}" optionValue="account" optionKey="accountId" from="${com.next.AccountTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}" />
                            </div>
                            
                        </div>
                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>状态</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">评级</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="rating" id="rating" optionValue="name"
                                          optionKey="id"
                                          from="${com.next.LeadRating.list()}" value="${this.lead?.rating?.id}"
                                          noSelection="${['': '请选择']}"/>
                            </div>

                            <label class="col-md-2 col-form-label">状态</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="status" id="status" optionValue="name"
                                          optionKey="id"
                                          from="${com.next.LeadStatus.list()}" value="${this.lead?.status?.id}"
                                          noSelection="${['': '请选择']}"/>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>线索信息</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">姓名</label>

                            <div class="col-md-3">
                                <g:textField class="form-control" name="fullName" id="fullName"
                                             value="${this.lead?.fullName}"/>
                            </div>
                            <label class="col-md-2 col-form-label">称谓</label>

                            <div class="col-md-3">
                                <g:select class="form-control" name="salutation" id="salutation" optionValue="name"
                                          optionKey="id" from="${com.next.Salutation.list()}"
                                          noSelection="${['': '请选择']}"
                                          value="${this.lead?.salutation?.id}"/>
                            </div>

                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">头衔</label>

                            <div class="col-md-3">
                                <g:textField class="form-control" name="title" id="title" value="${this.lead?.title}"/>
                            </div>
                            <label class="col-md-2 col-form-label">邮件</label>

                            <div class="col-md-3">
                                    <g:field type="email" class="form-control" name="email" id="email"
                                                 value="${this.lead?.email}"/>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">手机</label>

                            <div class="col-md-3">
                                <g:textField class="form-control" name="cellphone" id="cellphone"
                                             value="${this.lead?.cellphone}"/>
                            </div>
                            <label class="col-md-2 col-form-label">座机</label>

                            <div class="col-md-3">
                                    <g:textField class="form-control" name="phone" id="phone"
                                                 value="${this.lead?.phone}"/>
                            </div>
                        </div>

                        <div class="form-group row">
                            <label class="col-md-2 col-form-label">线索描述</label>
                            <div class="col-md-8">
                                <g:textArea rows="3" class="form-control" name="description" id="description" value="${this.lead?.description}"/></div>
                        </div>

                        <div class="form-group row">
                            <div class="col-md-12">
                                <g:submitButton class="btn btn-info" name="update" value="保存"/>
                            </div>
                        </div>
                    </div>
                </div>

            </g:form>
        </div>

        <!-- Page-body end -->
    </div>
</div>

</body>

</html>
